extends Control

var credits = [
	"PROGRAMMING\nJason Ko MacDuffie",
	"GRAPHICS\nJason Ko MacDuffie",
	"MUSIC\nJason Ko MacDuffie",
	"SOUND EFFECTS\nJason Ko MacDuffie",
	"TESTING\nCollette Manning",
	"GODOT ENGINE\nVarious contributors",
	"DROID FONTS\nGoogle Corp.",
	"SPECIAL THANKS\nYou, the player"
]

var counter = 0

func _ready():
	get_node("music").set_stream(load("res://Music/credits.ogg"))
	get_node("music").play()
	set_process(true)

func _process(delta):
	if (Input.is_action_pressed("ui_accept")):
		change_scenes("res://Scenes/main_menu.tscn")

func next_credit():
	if (counter < credits.size()):
		get_node("text").set_text(credits[counter])
		counter += 1
	else:
		change_scenes("res://Scenes/main_menu.tscn")


func change_scenes(next_scene):
	get_node("music").stop()
	get_node("music").queue_free()
	get_node("/root/global").goto_scene(next_scene)
	get_node("/root/global").current_scene.get_node("button_credits").grab_focus()
